<?php
require_once './libs/base_factory.php';
$g_factory = new extend_factory();

$src  = isset($_GET['src']) ? $_GET['src'] : 'data';
$lnk  = isset($_GET['lnk']) ? $_GET['lnk'] : '';
$type = isset($_GET['t'])   ? $_GET['t']   : '1';

if (!empty($lnk) && file_exists($g_factory->base_constants['path'][$src] . '/' . $lnk)) {
	if ($type == 1) {
		header("Content-Type: application/text;charset=utf-8");
		header("Content-Disposition: attachment; filename=\"$lnk\";" );
		header("Content-Length: ".filesize($g_factory->base_constants['path'][$src] . '/' . $lnk));
	}
	if ($type == 2)
		readfile($g_factory->base_constants['path'][$src] . '/' . $lnk);
	
}
?>